/*
 * @Title: 
 * @Description: 
 * @Author: 靖博君
 * @Date: 2023-12-07 15:43:14
 * @FilePath: /cwpf-saas-web/packages/cwpf-saas-web/src/utils/AESPassword.ts
 */
import CryptoJS from 'crypto-js';
const keyStr = 'CWPF202312060001';
export function encrypt(word: any) {
  const key = CryptoJS.enc.Utf8.parse(keyStr);
  const srcs = CryptoJS.enc.Utf8.parse(word);
  const encrypted = CryptoJS.AES.encrypt(srcs, key, {
    mode: CryptoJS.mode.ECB,
    padding: CryptoJS.pad.Pkcs7,
  });
  return encrypted.toString();
}
export function decrypt(word: any) {
  const key = CryptoJS.enc.Utf8.parse(keyStr);
  const decrypt = CryptoJS.AES.decrypt(word, key, {
    mode: CryptoJS.mode.ECB,
    padding: CryptoJS.pad.Pkcs7,
  });
  return CryptoJS.enc.Utf8.stringify(decrypt).toString();
}
